Api = {
	me : new CurrentUser()

};

function CurrentUser() {
	this.getMarkers = function(success, error) {
		$.ajax(contextPath + "/api/me/markers", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.addMarker = function(marker, success, error)
	{
		$.ajax(contextPath + "/api/me/markers", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'POST',
			data : marker
		});
	};
	
	this.getMarker = function(id, success, error) {
		
		$.ajax(contextPath + "/api/me/markers/" + id, {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.editMarker = function(id, marker, success, error) {
		$.ajax(contextPath + "/api/me/markers/" + id, {
			success : success,
			error : error,
			dataType : 'json',
			type : 'POST',
			data : marker
		});
	};
	
	this.deleteMarker = function(id, success, error) {
		
		$.ajax(contextPath + "/api/me/markers/" + id, {
			success : success,
			error : error,
			type : 'DELETE'
		});
	};
	
	this.inviteFriend = function(friendUsername, success, error){
		var data = "friend_username=" + friendUsername;
		$.ajax(contextPath + "/api/me/friends/", {
			success : success,
			error : error,
			type: "POST",
			data: data
		});
	};
	
	this.getInvitations = function(success, error) {
		$.ajax(contextPath + "/api/me/notification", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.setInvitation = function(from, status, success, error) {
		var data = "user=" + from + "&accept=" + status;
		$.ajax(contextPath + "/api/me/invitation/", {
			success : success,
			error : error,
			type: "POST",
			data: data
		});
	};
	
	this.getTrackedFriends = function(success, error) {
		$.ajax(contextPath + "/api/me/friends/follow", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.getUserLocalization = function(username, success, error) {
		$.ajax(contextPath + "/api/users/" + username + "/location", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.getFriends = function(success, error) {
		$.ajax(contextPath + "/api/me/friends", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
	
	this.getFriendMarkers = function(username, success, error) {
		$.ajax(contextPath + "/api/users/" + username + "/markers", {
			success : success,
			error : error,
			dataType : 'json',
			type : 'GET'
		});
	};
}